﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YasharEl.Infrastructure.ResourcesManagement;
using System.Globalization;
using System.Runtime.Serialization;

namespace YasharEl.Infrastructure.ProcessEngine
{
    [Serializable]
    public class CouldNotFindWorkflowProgramException : TranslatedDomainModelException
    {
        private const string CouldNotFindWorkflowProgram = "CouldNotFindWorkflowProgram";
        private readonly string _workflowXaml;

        public string WorkflowXaml
        {
            get { return _workflowXaml; }
        }

        public CouldNotFindWorkflowProgramException(IResourceManager resourceManager, string workflowXaml)
            : base
             (
                resourceManager,
                string.Format(
                    resourceManager.GetString(CouldNotFindWorkflowProgram, CultureInfo.GetCultureInfo("en")),
                    workflowXaml
                )
             )
        {
            _workflowXaml = workflowXaml;
        }

        protected CouldNotFindWorkflowProgramException(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
        }

        protected override string ExceptionMessageResourceKey
        {
            get { return CouldNotFindWorkflowProgram; }
        }

        public override string TranslatedMessage
        {
            get
            {
                return string.Format(resourceManager.GetString(CouldNotFindWorkflowProgram), WorkflowXaml);
            }
        }
    }
}
